-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create pit service layer changes #3921
Create pit service layer changes #3921
Conversation
361dc37
to
8a8f708
Compare
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #3921 +/- ##
============================================
+ Coverage 70.57% 70.70% +0.13%
- Complexity 56679 56892 +213
============================================
Files 4563 4573 +10
Lines 272755 273256 +501
Branches 40040 40076 +36
============================================
+ Hits 192505 193219 +714
+ Misses 64014 63800 -214
- Partials 16236 16237 +1
Continue to review full report at Codecov.
|
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
8a8f708
to
fa9946b
Compare
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
9356bd4
to
a0b09ad
Compare
Gradle Check (Jenkins) Run Completed with:
|
/cc: @sachinpkale for review |
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
a0b09ad
to
bfcb50a
Compare
Gradle Check (Jenkins) Run Completed with:
|
/cc : @sachinpkale for help with review |
@@ -50,7 +50,7 @@ public final class SearchContextIdForNode implements Writeable { | |||
private final ShardSearchContextId searchContextId; | |||
private final String clusterAlias; | |||
|
|||
SearchContextIdForNode(@Nullable String clusterAlias, String node, ShardSearchContextId searchContextId) { | |||
public SearchContextIdForNode(@Nullable String clusterAlias, String node, ShardSearchContextId searchContextId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it made public? All the new classes are in the same package, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed it
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
… into createpitservice
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
27dedb3
to
5d8ec6b
Compare
Gradle Check (Jenkins) Run Completed with:
|
public CreatePitController( | ||
CreatePitRequest request, | ||
SearchTransportService searchTransportService, | ||
ClusterService clusterService, | ||
TransportSearchAction transportSearchAction, | ||
NamedWriteableRegistry namedWriteableRegistry, | ||
Task task, | ||
ActionListener<CreatePitResponse> listener | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets create a singleton CreatePitController
and remove the CreatePitRequest
from the constructor, it should be a part of execute
request part
* This setting will help validate the max keep alive that can be set during creation or extension for a PIT reader context | ||
*/ | ||
public static final Setting<TimeValue> MAX_PIT_KEEPALIVE_SETTING = Setting.positiveTimeSetting( | ||
"pit.max_keep_alive", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets use point_in_time everywhere to be consistent
protected AtomicLong getLastAccessTime() { | ||
return lastAccessTime; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just return lastAccessTime.get()
that way its immutable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use this method to update the last access time
getLastAccessTime().updateAndGet(curr -> Math.max(curr, nowInMillis()));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a violation of the GET
API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay agreed, made the change to just update in base class.
/** | ||
* Get connection lookup listener for list of clusters passed | ||
*/ | ||
public static StepListener<BiFunction<String, String, DiscoveryNode>> getConnectionLookupListener( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look generic enough, espl that it is in a utility class. Can we have it return a plain ActionListener
instead
bf4c4ee
to
6963b68
Compare
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
6963b68
to
987cb57
Compare
final StepListener<BiFunction<String, String, DiscoveryNode>> lookupListener = new StepListener<>(); | ||
|
||
if (clusters.isEmpty()) { | ||
lookupListener.onResponse((cluster, nodeId) -> state.getNodes().get(nodeId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my understanding what is this call supposed to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this is a a predicate which will give the node info given the cluster alias and node id.
- if clusters are empty, we will just give the node info from the current cluster state
- otherwise we will use remote cluster service to collect nodes from all clusters mentioned and return the node based on cluster alias and node id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But aren't we calling the onResponse
instead of overriding the onResponse for the listener like
new ActionListener() {
public void onResponse() {
blah
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is step listener, we will return the listener and the callers will do whenComplete() to perform action after the node lookup. This is technically a synchronous flow since caller will wait for whenComplete .
public method1 {
Listener listener = getConnListener();
listener.whenComplete(do something);
}
Gradle Check (Jenkins) Run Completed with:
|
try { | ||
listener.onNewPitContext(readerContext); | ||
} catch (Exception e) { | ||
logger.warn("onNewPitContext listener failed", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note single listener failure will abort all other listeners as well. Is this expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but since we only log and not throw exception , It will not abort other listeners right?
int sliceLimit = indexService.getIndexSettings().getMaxSlicesPerPit(); | ||
int numSlices = sliceBuilder.getMax(); | ||
if (numSlices > sliceLimit) { | ||
throw new IllegalArgumentException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we throw OpenSearchRejectedException
which should result in 429 instead of 5xx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i checked the enum, it does show 429 but that corresponds to "too many requests", should we still go ahead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
Gradle Check (Jenkins) Run Completed with:
|
8fcc25c
to
ed20a79
Compare
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
ed20a79
to
8067e7b
Compare
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Bharathwaj G bharath78910@gmail.com
Description
Create point in time changes - merging the service layer changes as part of this PR and Rest changes will come in as part of separate PR.
Reference PR - Already reviewed create PIT API PR in feature branch -> #2745
Issues Resolved
#1147
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.